import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

void showCupertinoAlertDialog(
    {required String title,
    required String desc,
    String cancelTxt = "取消",
    String okTxt = "确定",
    required VoidCallback okClickCallback}) {
  showDialog(
      context: Get.context!,
      builder: (BuildContext context) {
        return CupertinoAlertDialog(
          title: Text(title),
          content: Column(
            children: [
              Text(
                desc,
                textAlign: TextAlign.center,
              ),
            ],
          ),
          actions: <Widget>[
            CupertinoDialogAction(
              child: Text(cancelTxt),
              onPressed: () {
                Get.back();
              },
            ),
            CupertinoDialogAction(
              child: Text(
                okTxt,
              ),
              onPressed: () {
                okClickCallback();
                Get.back();
              },
            ),
          ],
        );
      });
}
